package com.nirvana.flatbuffers;


/**
 * Copyright (c) 2022 Aoshu.Co.Ltd. All rights reserved.
 *
 * @author :    zhouqichun
 * @create :    2025/11/13 14:06
 * @description :
 **/
public interface IResolve {
    boolean canResolve(String propertyType);

    String resolve(StringBuilder objectPreContent, String defName, String propertyName, String propertyType);

    String resolveVector(StringBuilder objectPreContent, String defName, String propertyName, String propertyType);

    default void resolveBaseField(StringBuilder fieldContent, String defName, String comment, String propertyName, String propertyType) {}

    default void resolveFbWrapperField(StringBuilder fieldContent, String defName, String comment, String propertyName, String propertyType) {
        fieldContent.append("""
                    /** %s */
                    def %s: %s = raw.%s
                """.formatted(comment, propertyName, propertyType, propertyName));
    }
}
